.TH std::experimental::erase(std::basic_string) 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::experimental::erase(std::basic_string) \- std::experimental::erase(std::basic_string)

.SH Synopsis
   Defined in header <experimental/string>
   template< class CharT, class Traits, class A, class U
   >                                                       (library fundamentals TS v2)
   void erase( std::basic_string<CharT, Traits, A>& c,
   const U& value );

   Erases all elements that compare equal to value from the container. Equivalent to
   c.erase(std::remove(c.begin(), c.end(), value), c.end());.

.SH Parameters

   c     - container from which to erase
   value - value to be removed

.SH Complexity

   Linear.

.SH Example


// Run this code

 #include <experimental/string>
 #include <iostream>

 int main()
 {
     std::string data{"$$P$A$S$S$$W$O$R$$D$"};
     std::cout << data << '\\n';
     auto crack{'$'};
     std::experimental::erase(data, crack);
     std::cout << data << '\\n';
 }

.SH Output:

 $$P$A$S$S$$W$O$R$$D$
 PASSWORD

.SH See also

   remove                       removes elements satisfying specific criteria
   remove_if                    \fI(function template)\fP
   erase_if (std::basic_string) erases all elements satisfying a predicate from a
   (library fundamentals 2 TS)  std::basic_string
                                \fI(function template)\fP
